$(function() {
    $('#vue_vm_list div').hide();
    $("#searchBtn").on("click",function () {
        findSummary();
    })
});

function findSummary() {
    if($('#vue_vm_list div').length==0) {return;}
    $('#vue_vm_list div').hide();

    var startYear = $('#startYear').val();
    var startMonth = $('#startMonth').val();
    var startDay = $('#startDay').val();
    var endYear = $('#endYear').val();
    var endMonth = $('#endMonth').val();
    var endDay = $('#endDay').val();
    var startTime = getStandardDay(startYear, startMonth, startDay);
    var endTime = getStandardDay(endYear, endMonth, endDay);

    if(isEmpty(startYear)) {
        alert('请输入开始年');
        return;
    }
    if(isEmpty(startMonth)) {
        alert('请选择开始月');
        return;
    }
    if(isEmpty(startDay)) {
        alert('请选择开始日');
        return;
    }
    if(isEmpty(endYear)) {
        alert('请输入结束年');
        return;
    }
    if(isEmpty(endMonth)) {
        alert('请选择结束月');
        return;
    }
    if(isEmpty(endDay)) {
        alert('请选择结束日');
        return;
    }
    if(isEmpty(startTime)) {
        alert('请输入开始时间');
        return;
    }
    if(isEmpty(endTime)) {
        alert('请输入结束时间');
        return;
    }

    find_basic_by_json(path+'/elderPayRecord/findSummary', {dateSince: startTime, dateEnd: endTime},
        onSuccess=function(response) {
            new Vue({
                el: '#vue_vm_list',
                data: {
                    todos: response.data
                },
                methods: {
                    getPrintDate:function() {
                        return printDate;
                    },
                    getStartTime:function () {
                        return startTime;
                    },
                    getEndTime:function () {
                        return endTime;
                    }
                }
            });
            $('#vue_vm_list div').show();
        },
        onEmpty=function(response) {
            alert("暂无数据");
            new Vue({
                el: '#vue_vm_list',
                data: {
                    todos: response.data
                },
                methods: {
                    getPrintDate:function() {
                        return printDate;
                    },
                    getStartTime:function () {
                        return startTime;
                    },
                    getEndTime:function () {
                        return endTime;
                    }
                }
            });

            $('#vue_vm_list div').show();
        }
    );
}